# Maintainer: Martell Malone < martell malone at g mail dot com >

_realname=onig
_fullname=oniguruma

pkgname=("${MINGW_PACKAGE_PREFIX}-${_fullname}")
pkgver=5.9.5
pkgrel=1
pkgdesc="A regular expressions library"
arch=('any')
groups=("${MINGW_PACKAGE_PREFIX}")
license=('BSD')
url="http://www.geocities.jp/kosako3/oniguruma"
depends=()
#depends=("${MINGW_PACKAGE_PREFIX}-bzip2")
options=('staticlibs')

source=("http://www.geocities.jp/kosako3/${_fullname}/archive/${_realname}-${pkgver}.tar.gz")
md5sums=('SKIP')

#prepare()

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  ./configure --prefix=${MINGW_PREFIX} \
      --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make
  ${MINGW_PREFIX}/bin/gcc -shared .libs/*.o -o libonig.dll -Xlinker --out-implib -Xlinker libonig.dll.a
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}
  make install DESTDIR="${pkgdir}"
  install -m644 "libonig.dll" "$pkgdir/${MINGW_PREFIX}/bin/"
  install -m644 "libonig.dll.a" "$pkgdir/${MINGW_PREFIX}/lib/"
}
